﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ZhouYu.DreamTour.BLL.IService;
using ZhouYu.DreamTour.DAL.IRepository;
using ZhouYu.DreamTour.Model;
using ZhouYu.DreamTour.ViewModel;
using ZhouYu.DreamTour.DAL.Repository;
using ZhouYu.DreamTour.Romote;
using System.Configuration;

namespace ZhouYu.DreamTour.BLL.Service
{
    public class UserService:IUserService
    {
        private IUserRepository _userRepository;
        public UserService(IUserRepository userRepository)
        {
            _userRepository = userRepository;
        }

        /// <summary>
        /// 用户登录方法
        /// </summary>
        /// <param name="adminInfo"></param>
        /// <returns></returns>
        public ResponseResult LoginUserInfo(UserInfo userInfo)
        {
            //创建响应结果类对象
            ResponseResult responseResult = new ResponseResult();
            //UserInfo user = _userRepository.LoginUserInfo(userInfo);
            responseResult.data = _userRepository.LoginUserInfo(userInfo);
            //调用用户登录方法
            //bool result = user != null;
            //如果登录成功即同时修改上一次登录时间和当前登录IP
            if (responseResult.data!=null)
            {
                responseResult.Success = _userRepository.UpdateLoginTime(userInfo)>0;
                if (responseResult.Success)
                {
                    return responseResult;
                }
            }
            return responseResult;
        }


        /// <summary>
        /// 用户手机注册
        /// </summary>
        /// <param name="userInfo"></param>
        /// <returns></returns>
        public ResponseResult AddUserInfo(UserInfo userInfo)
        {
            //创建响应结果类对象
            ResponseResult responseResult = new ResponseResult();
            //调用用户手机注册
            responseResult.Success= _userRepository.AddUserInfo(userInfo)>0;
            return responseResult;
        }


        /// <summary>
        /// 用户邮箱注册
        /// </summary>
        /// <param name="userInfo"></param>
        /// <returns></returns>
        public ResponseResult AddUserEmailInfo(UserInfo userInfo)
        {
            //创建响应结果类对象
            ResponseResult responseResult = new ResponseResult();
            //调用用户邮箱注册
            responseResult.Success = _userRepository.AddUserEmailInfo(userInfo) > 0;
            return responseResult;
        }


        /// <summary>
        /// 查询邮箱验证码是否存在
        /// </summary>
        /// <param name="userInfo"></param>
        /// <returns></returns>
        public ResponseResult CheckEmailCode(EmailInfo emailInfo)
        {
            //创建响应结果类对象
            ResponseResult responseResult = new ResponseResult();
            //调用查询邮箱验证码是否存在
            responseResult.Success = _userRepository.CheckEmailCode(emailInfo) > 0;
            return responseResult;
        }



        /// <summary>
        /// 发送邮箱验证码
        /// </summary>
        /// <param name="userInfo"></param>
        /// <returns></returns>
        public ResponseResult SendEmailCode(string email)
        {
            //调用发送邮箱验证码方法
            ResponseResult responseResult = new ResponseResult();
            Random random = new Random();
            int emailcode=random.Next(100000, 999999);
            //创建邮箱对象
            Email ema = new Email();
            ema.mailFrom = "897281048@qq.com";
            ema.mailPwd = "kypkcmhsuytlbajc";
            ema.mailToArray = new string[] { email };   //收件人
            ema.host = ConfigurationManager.AppSettings[ema.mailFrom.Substring(ema.mailFrom.IndexOf('@') + 1)].ToString();
            ema.mailSubject = "邮件验证码";      //标题
            ema.mailBody = "您的验证码为："+emailcode+"，请在20分钟内验证，系统邮件请勿回复！";    //正文
            //发送邮件验证码
            responseResult.Success = ema.Send();
            if (responseResult.Success)
            {
                //创建邮箱信息对象
                EmailInfo emailInfo = new EmailInfo();
                emailInfo.Code = emailcode;
                emailInfo.Email = email;
                //添加邮箱发送记录
                responseResult.Success = _userRepository.AddEmailInfo(emailInfo)>0;
            }
            return responseResult;
        }


        /// <summary>
        /// 查询邮箱是否存在
        /// </summary>
        /// <param name="userInfo"></param>
        /// <returns></returns>
        public ResponseResult CheckUser_Email(UserInfo userInfo)
        {
            //创建响应结果类对象
            ResponseResult responseResult = new ResponseResult();
            //调用查询邮箱是否存在
            responseResult.Success = _userRepository.CheckUser_Email(userInfo) > 0;
            return responseResult;
        }

        /// <summary>
        /// 查询手机号
        /// </summary>
        /// <param name="userInfo"></param>
        /// <returns></returns>
        public ResponseResult CheckUserTel(UserInfo userInfo)
        {
            //创建响应结果类对象
            ResponseResult responseResult = new ResponseResult();
            //调用查询手机号
            responseResult.Success= _userRepository.CheckUserTel(userInfo)>0;
            return responseResult;
        }
       

   

        /// <summary>
        /// 修改当前用户密码
        /// </summary>
        /// <returns></returns>
        public int Changepwd(string Pwd, int UserId)
        {
            return _userRepository.Changepwd(Pwd,UserId);
        }

        public List<DeliveryAddress> AddressList(int UserId)
        {
            return _userRepository.AddressList(UserId);
        }

        public List<Custompoints> IntegralList(string Createtime, string Effective, int User_Id)
        {
            return _userRepository.IntegralList(Createtime,Effective,User_Id);
        }
        ///<summary>
        ///根据Id删除配送地址
        ///</summary>
        ///<returns</resturns>

        public int DeleteAddress(int Id)
        {
            return _userRepository.DeleteAddress(Id);
        }
        /// <summary>
        /// 增加配送地址
        /// </summary>
        /// <param name="address"></param>
        /// <returns></returns>
        public int AddAddress(DeliveryAddress address)
        {
            return _userRepository.AddAddress(address);
        }
        /// <summary>
        /// 修改配送地址
        /// </summary>
        /// <param name="address"></param>
        /// <returns></returns>
        public int UpdateAddress(DeliveryAddress address)
        {
            return _userRepository.UpdateAddress(address);
        }
    

        /// <summary>
        /// 根据用户Id查询待点评次数
        /// </summary>
        /// <param name="Name"></param>
        /// <returns></returns>
        public Usercomment QueryUsertobecommentedon(int  UserId)
        {
            return _userRepository.QueryUsertobecommentedon(UserId);
        }


        /// <summary>
        /// 根据id获取用户信息
        /// </summary>
        /// <param name="userInfo"></param>
        /// <returns></returns>
        public ResponseResult GetUserById(int id)
        {
            //创建响应结果类对象
            ResponseResult responseResult = new ResponseResult();
            //调用用户注册添加方法
            responseResult.data = _userRepository.GetUserById(id);
            return responseResult;
        }

        /// <summary>
        /// 根据id获取用户现金账号信息
        /// </summary>
        /// <param name="userInfo"></param>
        /// <returns></returns>
        public ResponseResult GetCashById(int id)
        {
            //创建响应结果类对象
            ResponseResult responseResult = new ResponseResult();
            //调用用户注册添加方法
            responseResult.data = _userRepository.GetCashById(id);
            return responseResult;
        }


        /// <summary>
        /// 根据id获取用户订单信息
        /// </summary>
        /// <param name="userInfo"></param>
        /// <returns></returns>
        public ResponseResult GetOrderById(int id)
        {
            //创建响应结果类对象
            ResponseResult responseResult = new ResponseResult();
            //调用用户注册添加方法
            responseResult.data = _userRepository.GetOrderById(id);
            return responseResult;
        }

        /// <summary>
        /// 根据id查询用户抵用卷信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ResponseResult GetVoucherById(int id)
        {
            //创建响应结果类对象
            ResponseResult responseResult = new ResponseResult();
            //调用用户注册添加方法
            responseResult.data = _userRepository.GetVoucherById(id);
            return responseResult;
        }

        /// <summary>
        /// 根据id查询用户抵用卷信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ResponseResult GetVoucherByKey(int id)
        {
            //创建响应结果类对象
            ResponseResult responseResult = new ResponseResult();
            //调用用户注册添加方法
            responseResult.data = _userRepository.GetVoucherByKey(id);
            return responseResult;
        }

        /// <summary>
        /// 修改用户抵用卷余额
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ResponseResult EditUserVoucher(UserInfo user)
        {
            //创建响应结果类对象
            ResponseResult responseResult = new ResponseResult();
            //调用用户注册添加方法
            responseResult.Success = _userRepository.EditUserVoucher(user)>0;
            return responseResult;
        }


        /// <summary>
        /// 修改抵用卷状态
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ResponseResult EditVoucherState(Voucher voucher)
        {
            //创建响应结果类对象
            ResponseResult responseResult = new ResponseResult();
            //调用用户注册添加方法
            responseResult.Success = _userRepository.EditVoucherState(voucher)>0;
            return responseResult;
        }


        /// <summary>
        /// 根据id查询用户抵用卷信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ResponseResult GetTourVo(int id)
        {
            //创建响应结果类对象
            ResponseResult responseResult = new ResponseResult();
            //调用用户注册添加方法
            responseResult.data = _userRepository.GetTourVo(id);
            return responseResult;
        }


        /// <summary>
        /// 根据主键查询用户旅游卷信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ResponseResult GetTravelVoByKey(int id)
        {
            //创建响应结果类对象
            ResponseResult responseResult = new ResponseResult();
            //调用用户注册添加方法
            responseResult.data = _userRepository.GetTravelVoByKey(id);
            return responseResult;
        }


        /// <summary>
        /// 修改用户抵用卷余额
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ResponseResult EditUserTravelVo(UserInfo user)
        {
            //创建响应结果类对象
            ResponseResult responseResult = new ResponseResult();
            //调用用户注册添加方法
            responseResult.Success = _userRepository.EditUserTravelVo(user) > 0;
            return responseResult;
        }


        /// <summary>
        /// 修改抵用卷状态
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ResponseResult EditTravelVoState(Travelvo travelvo)
        {
            //创建响应结果类对象
            ResponseResult responseResult = new ResponseResult();
            //调用用户注册添加方法
            responseResult.Success = _userRepository.EditTravelVoState(travelvo) > 0;
            return responseResult;
        }


        /// <summary>
        /// 修改抵用卷状态
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ResponseResult CheckTravelVoPwd(Travelvo travelvo)
        {
            //创建响应结果类对象
            ResponseResult responseResult = new ResponseResult();
            //调用用户注册添加方法
            responseResult.Success = _userRepository.CheckTravelVoPwd(travelvo) > 0;
            return responseResult;
        }

        /// <summary>
        /// 获取用户旅游订单集合
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public List<OrderInfo> GetTourOrder(int id)
        {
            return  _userRepository.GetTourOrder(id);
        }

        /// <summary>
        /// 获取用户团购订单集合
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public List<OrderInfo> GetGroupOrder(int id)
        {
            return _userRepository.GetGroupOrder(id);
        }

        /// <summary>
        /// 获取用户餐饮订单集合
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public List<OrderInfo> GetCateringOrder(int id)
        {
            return _userRepository.GetCateringOrder(id);
        }

        /// <summary>
        /// 获取用户酒店订单集合
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public List<OrderInfo> GetHotelOrder(int id)
        {
            return _userRepository.GetHotelOrder(id);
        }

        /// <summary>
        /// 获取用户特产订单集合
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public List<OrderInfo> GetGoodsOrder(int id)
        {
            return _userRepository.GetGoodsOrder(id);
        }
        /// <summary>
        /// 根据Id查询用户积分
        /// </summary>
        /// <param name="UserId"></param>
        /// <returns></returns>
        public Custompoints Queryintegral(int UserId)
        {
            return _userRepository.Queryintegral(UserId);
        }

        /// <summary>
        ///根据用户Id查询用户提问记录
        /// </summary>
        /// <param name="UserId"></param>
        /// <returns></returns>
        public  List<Questions> Queryuserask(int UserId)
        {
            return _userRepository.Queryuserask(UserId);
        }

        /// <summary>
        ///根据用户Id查询用户回复记录
        /// </summary>
        /// <param name="UserId"></param>
        /// <returns></returns>
        public List<Reply> QueryReply(int UserId)
        {
            return _userRepository.QueryReply(UserId);
        }

       
        //查询用户已点评
        public List<Usercomment> Querycomment(int userId)
        {
            return _userRepository.Querycomment(userId);

        }
        //删除用户点评
        public int Deletecomments(int id)
        {
            return _userRepository.Deletecomments(id);
        }
        //修改地址状态
         public  int Modifyaddressstatus(int Id)
        {
            return _userRepository.Modifyaddressstatus(Id);
        }
        //修改地址状态全部为0
         public  int UpdateAlladdressStates(int UserId)
        {
            return _userRepository.UpdateAlladdressStates(UserId);
        }

        #region 根据拥护ID查询现金账号表
        /// <summary>
        /// 根据拥护ID查询现金账号表
        /// </summary>
        /// <param name="User_Id"></param>
        /// <returns></returns>
        public ResponseResult GetCashnumber(int User_Id)
        {
            ResponseResult responseResult = new ResponseResult();
            responseResult.data = _userRepository.GetCashnumber(User_Id);
            return responseResult;
        }

 

        #endregion


        /// <summary>
        /// 添加发起人信息表
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ResponseResult AddOriginator(Originator originator)
        {
            //创建响应结果类对象
            ResponseResult responseResult = new ResponseResult();
            //调用添加发起人信息表方法
            responseResult.Success = _userRepository.AddOriginator(originator) > 0;
            return responseResult;
        }


        /// <summary>
        /// 获取发起人信息表最后一条记录的主键
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ResponseResult GetOriginatorLast()
        {
            //创建响应结果类对象
            ResponseResult responseResult = new ResponseResult();
            //调用获取发起人信息表最后一条记录的主键方法
            responseResult.data = _userRepository.GetOriginatorLast();
            return responseResult;
        }

        /// <summary>
        /// 获取发起人信息表最后一条记录的主键
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ResponseResult AddColleague(Colleague colleague)
        {
            //创建响应结果类对象
            ResponseResult responseResult = new ResponseResult();
            //调用获取发起人信息表最后一条记录的主键方法
            responseResult.Success = _userRepository.AddColleague(colleague) >0;
            return responseResult;
        }


        /// <summary>
        /// 获取结伴同行表最后一条记录的主键
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ResponseResult GetColleagueLast()
        {
            //创建响应结果类对象
            ResponseResult responseResult = new ResponseResult();
            //调用获取结伴同行表最后一条记录的主键方法
            responseResult.data = _userRepository.GetColleagueLast();
            return responseResult;
        }

        /// <summary>
        /// 添加结伴同行人数表
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ResponseResult AddNumbers(List<Number> numbers)
        {
            //创建响应结果类对象
            ResponseResult responseResult = new ResponseResult();
            //调用添加结伴同行人数表方法
            for (int i = 0; i < numbers.Count; i++)
            {
                responseResult.Success = _userRepository.AddNumbers(numbers[i]) > 0;
                if (!responseResult.Success) 
                {
                    return responseResult;
                }
            }
            return responseResult;
        }


        /// <summary>
        /// 获取返现现金账号信息记录
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ResponseResult GetCashReturn(int id)
        {
            //创建响应结果类对象
            ResponseResult responseResult = new ResponseResult();
            //调用获取返现现金账号信息记录方法
            responseResult.data = _userRepository.GetCashReturn(id);
            return responseResult;
        }


        /// <summary>
        /// 获取提现现金账号信息记录
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ResponseResult GetCash(int id)
        {
            //创建响应结果类对象
            ResponseResult responseResult = new ResponseResult();
            //调用获取提现现金账号信息记录方法
            responseResult.data = _userRepository.GetCash(id);
            return responseResult;
        }


        /// <summary>
        /// 获取返现现金账号信息记录
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ResponseResult GetCashReturnCount(int id)
        {
            //创建响应结果类对象
            ResponseResult responseResult = new ResponseResult();
            //调用获取返现现金账号信息记录方法
            responseResult.data = _userRepository.GetCashReturnCount(id);
            return responseResult;
        }


        /// <summary>
        /// 获取提现现金账号信息记录
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ResponseResult GetCashCount(int id)
        {
            //创建响应结果类对象
            ResponseResult responseResult = new ResponseResult();
            //调用获取提现现金账号信息记录方法
            responseResult.data = _userRepository.GetCashCount(id);
            return responseResult;
        }


        /// <summary>
        /// 获取返现现金账号信息记录
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ResponseResult GetCashbalance(int id)
        {
            //创建响应结果类对象
            ResponseResult responseResult = new ResponseResult();
            //调用获取返现现金账号信息记录方法
            responseResult.data = _userRepository.GetCashbalance(id);
            return responseResult;
        }


        /// <summary>
        /// 获取返现现金账号信息记录
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ResponseResult AddCashOut(CashOut cash)
        {
            //创建响应结果类对象
            ResponseResult responseResult = new ResponseResult();
            //调用获取返现现金账号信息记录方法
            responseResult.Success = _userRepository.AddCashOut(cash)>0;
            return responseResult;
        }


        /// <summary>
        /// 添加现金帐号操作记录
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ResponseResult AddCashnumber_record(Cashnumber_record cashnumber_Record)
        {
            //创建响应结果类对象
            ResponseResult responseResult = new ResponseResult();
            //调用添加现金帐号操作记录方法
            responseResult.Success = _userRepository.AddCashnumber_record(cashnumber_Record) > 0;
            return responseResult;
        }

        /// <summary>
        /// 获取现金账号操作表最后一条记录的主键
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ResponseResult GetCashRecordLast()
        {
            //创建响应结果类对象
            ResponseResult responseResult = new ResponseResult();
            //调用添加现金帐号操作记录方法
            responseResult.data = _userRepository.GetCashRecordLast();
            return responseResult;
        }


        /// <summary>
        /// 修改现金账号余额
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ResponseResult EditCashBalance(Cashnumber cashnumber)
        {
            //创建响应结果类对象
            ResponseResult responseResult = new ResponseResult();
            //调用修改现金账号余额方法
            responseResult.Success = _userRepository.EditCashBalance(cashnumber) > 0;
            return responseResult;
        }

        /// <summary>
        /// 充值现金账号添加余额
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ResponseResult RechargeCashBalance(Cashnumber cashnumber)
        {
            //创建响应结果类对象
            ResponseResult responseResult = new ResponseResult();
            //调用充值现金账号添加余额
            responseResult.Success = _userRepository.RechargeCashBalance(cashnumber) > 0;
            return responseResult;
        }


        /// <summary>
        /// 查询审核未通过的信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ResponseResult QueryExamine()
        {
            //创建响应结果类对象
            ResponseResult responseResult = new ResponseResult();
            //调用查询审核未通过的信息方法
            responseResult.data = _userRepository.QueryExamine();
            return responseResult;
        }


        /// <summary>
        /// 添加旅游卷
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ResponseResult AddTravelVo(Travelvo travelvo)
        {
            //创建响应结果类对象
            ResponseResult responseResult = new ResponseResult();
            //调用添加旅游卷方法
            responseResult.Success = _userRepository.AddTravelVo(travelvo)>0;
            return responseResult;
        }


        /// <summary>
        /// 查询当前用户申请的结伴同行集合
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ResponseResult GetColleagueByUId(Colleague colleague)
        {
            //创建响应结果类对象
            ResponseResult responseResult = new ResponseResult();
            //调用查询当前用户申请的结伴同行集合方法
            responseResult.data = _userRepository.GetColleagueByUId(colleague);
            return responseResult;
        }


        /// <summary>
        /// 修改用户基本信息
        /// </summary>
        /// <param name="userInfo"></param>
        /// <returns></returns>
        public ResponseResult EditUserInfo(UserInfo userInfo)
        {
            //创建响应结果类对象
            ResponseResult responseResult = new ResponseResult();
            //调用修改用户基本信息方法
            responseResult.Success = _userRepository.EditUserInfo(userInfo) >0;
            return responseResult;
        }

        /// <summary>
        /// 修改用户手机号
        /// </summary>
        /// <param name="userInfo"></param>
        /// <returns></returns>
        public ResponseResult EditUserTel(UserInfo userInfo)
        {
            //创建响应结果类对象
            ResponseResult responseResult = new ResponseResult();
            //调用修改用户手机号方法
            responseResult.Success = _userRepository.EditUserTel(userInfo) > 0;
            return responseResult;
        }


        /// <summary>
        /// 修改用户邮箱
        /// </summary>
        /// <param name="userInfo"></param>
        /// <returns></returns>
        public ResponseResult EditUserEmail(UserInfo userInfo)
        {
            //创建响应结果类对象
            ResponseResult responseResult = new ResponseResult();
            //调用修改用户手机号方法
            responseResult.Success = _userRepository.EditUserEmail(userInfo) > 0;
            return responseResult;
        }


        /// <summary>
        /// 增加账户冻结金额
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ResponseResult AddCashFreeze(Cashnumber cashnumber)
        {
            //创建响应结果类对象
            ResponseResult responseResult = new ResponseResult();
            //调用增加账户冻结金额方法
            responseResult.Success = _userRepository.AddCashFreeze(cashnumber) > 0;
            return responseResult;
        }


        /// <summary>
        /// 增加账户冻结金额
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ResponseResult GetColleague()
        {
            //创建响应结果类对象
            ResponseResult responseResult = new ResponseResult();
            //调用增加账户冻结金额方法
            responseResult.data = _userRepository.GetColleague();
            return responseResult;
        }

        #region 绑定银行卡
        /// <summary>
        /// 绑定银行卡
        /// </summary>
        /// <param name="user_Bank"></param>
        /// <returns></returns>
        public ResponseResult BindBank(User_Bank user_Bank) 
        {
            //创建响应结果类对象
            ResponseResult responseResult = new ResponseResult();
            //User_Bank对象赋值
            user_Bank.Bank_CreateTime = DateTime.Now;
            user_Bank.Bank_UpdateTime = DateTime.Now;
            //调用绑定银行卡方法
            responseResult.Success = _userRepository.BindBank(user_Bank)>0;
            return responseResult;
        }
        #endregion

        #region 获取当前登录用户绑定的银行卡集合
        /// <summary>
        /// 获取当前登录用户绑定的银行卡集合
        /// </summary>
        /// <param name="User_Id"></param>
        /// <returns></returns>
        public ResponseResult QueryUserBank(int User_Id) 
        {
            //创建响应结果类对象
            ResponseResult responseResult = new ResponseResult();
            //创建User_Bank对象并赋值
            User_Bank user_Bank = new User_Bank();
            user_Bank.User_Id = User_Id;
            //调用获取当前登录用户绑定的银行卡集合方法
            responseResult.data = _userRepository.QueryUserBank(user_Bank);
            return responseResult;
        }
        #endregion


        #region 解绑指定银行卡
        /// <summary>
        /// 解绑指定银行卡
        /// </summary>
        /// <param name="user_Bank"></param>
        /// <returns></returns>
        public ResponseResult DelBank(User_Bank user_Bank)
        {
            //创建响应结果类对象
            ResponseResult responseResult = new ResponseResult();
            //调用解绑指定银行卡方法
            responseResult.Success = _userRepository.DelBank(user_Bank) > 0;
            return responseResult;
        }
        #endregion


        /// <summary>
        /// 获取旅游卷最后一条记录的主键
        /// </summary>
        /// <param name="travelvo"></param>
        /// <returns></returns>
        public ResponseResult GetTravelVoLast(Travelvo travelvo)
        {
            //创建响应结果类对象
            ResponseResult responseResult = new ResponseResult();
            //调用获取旅游卷最后一条记录的主键方法
            responseResult.data = _userRepository.GetTravelVoLast(travelvo);
            return responseResult;
        }

        /// <summary>
        /// 添加旅游卷操作记录
        /// </summary>
        /// <param name="travelvo_Record"></param>
        /// <returns></returns>
        public ResponseResult AddTravelVoRecord(Travelvo_record travelvo_Record)
        {
            //创建响应结果类对象
            ResponseResult responseResult = new ResponseResult();
            //调用添加旅游卷操作记录方法
            responseResult.Success = _userRepository.AddTravelVoRecord(travelvo_Record)>0;
            return responseResult;
        }
    }
}
